﻿using System;
using System.Windows.Forms;

namespace HYCodeBase.WinForm.WinFormRemindSuit
{
	internal class BaseReflectPropertyGeter : IAttributeGeter
	{
		private BaseReflectPropertyGeter()
		{
		}

		internal static BaseReflectPropertyGeter GetBaseReflectPropertyGeter()
		{
			if (BaseReflectPropertyGeter.m_singleTag == null)
			{
				BaseReflectPropertyGeter.m_singleTag = new BaseReflectPropertyGeter();
			}
			return BaseReflectPropertyGeter.m_singleTag;
		}

		public AttributeInformationBean GetOneAttributeBean(System.Windows.Forms.Control inputControl, string inputAttributeName)
		{
			AttributeInformationBean result = null;
			try
			{
				string inputValueString = inputControl.GetType().GetProperty(inputAttributeName).GetValue(inputControl).ToString();
				result = new AttributeInformationBean(inputAttributeName, inputValueString);
			}
			catch (Exception)
			{
			}
			return result;
		}

		private static BaseReflectPropertyGeter m_singleTag;
	}
}
